﻿using Moq;
using NUnit.Framework;
using Objectflow.core.tests.TestOperations;
using Rainbow.Demo.Objectflow.Client;
using Rainbow.ObjectFlow.Framework;
using Rainbow.ObjectFlow.Interfaces;
using Rainbow.ObjectFlow.Language;
using Shouldly;

namespace Objectflow.core.tests.UnitsTestWorkflows
{
    public class TestingWorkflowsClassesTest
    {
        [Test, Ignore]
        public void TestWorkflow()
        {
            // TODO make testable
            var workflowDefiner = new Mock<IDefine<CustomerState>>().As<IWorkflow<CustomerState>>();

            workflowDefiner.Setup(x => x.Do<PlaceOrder>()).Returns(workflowDefiner.Object);
            workflowDefiner.Setup(x => x.Do<PayForCoffee>()).Returns(workflowDefiner.Object);
            workflowDefiner.Setup(x => x.Do<PickUp>());

            var workflow = new CoffeeCustomerService(workflowDefiner.Object);
            workflow.Configure();

            workflowDefiner.VerifyAll();
        }
    }

    public class TestFactoryTests
    {
        [Test]
        public void CreateOperation_returns_instance()
        {
            var factory = TestFactory.CreateOperationFactory();
             var ob=factory.CreateOperation(OperationType.DoubleSpace);
            ob.ShouldNotBe(null);
            ob.ShouldBeTypeOf<IOperation<Colour>>();
        }
    }
}